// 导入axios实例
import { get, post } from '../utils/request';

// 任务审批状态相关API服务
export const taskApprovalService = {
  // 获取审批人正在处理的任务审批状态
  getApproverProcessingTasks: (approverId) => {
    return get(`/api/task-approval-status/approver/${approverId}/processing`);
  },
  
  // 获取审批人已审批的任务
  getApproverApprovedTasks: (approverId) => {
    return get(`/api/task-approval-status/approver/${approverId}/approved`);
  },
  
  // 获取任务节点详情
  getTaskNodeDetails: (taskId) => {
    return get(`/api/task-approval-status/task/${taskId}/node-details`);
  },
  
  // 获取任务流程状态信息
  getTaskProcessStatus: (taskId) => {
    return get(`/api/task-approval-status/task/${taskId}`);
  },
  
  // 审批任务
  approveTask: (data) => {
    return post('/api/task-approval-status/approve', data);
  },
  
  // 转发任务
  forwardTask: (data) => {
    return post('/api/task-approval-status/forward', data);
  },
  
  // 获取指定数据源的任务类型
  getTaskTypesByDataSource: (dataSourceId) => {
    return get(`/api/task-types/data-source/${dataSourceId}`);
  },
  
  // 获取任务当前处理节点信息
  getCurrentProcessingNodeByTaskId: (taskId) => {
    return get(`/api/task-approval-status/task/${taskId}/current-processing-node`);
  },
  
  // 获取指定数据源的用户统计信息
  getUserStatisticsByDataSource: (dataSourceId) => {
    return get(`/api/task-approval-status/datasource/${dataSourceId}/user-statistics`);
  },
  
  // 搜索新任务
  searchNewTasks: (data) => {
    return post('/api/new-tasks/search', data);
  }
};

export default taskApprovalService;